import { http } from '@/utils'
import { delToken } from '@/utils'
// 获取用户基本信息
export const getUserInfo = () => {
  return async (dispatch) => {
    const res = await http.get('/user/profile')
    // 存放至redux中
    dispatch({ type: 'user/getUserInfo', payload: res.data.data})
  }
}

// 退出页面
export const Lagout = () => {
  return dispatch => {
    // 清除redux,token
    dispatch({type:'user/delToken'})
    // 清除本地的token
    delToken()
    // 清除信息
    dispatch({type:'user/delState'})

  }
}

